home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / System 7.0 Samples / MacShell / EventLoop.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-04  |  1.8 KB  |  73 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** Program:             MacShell
  5. ** File:             eventloop.c
  6. ** Originally from:  Traffic Light 2.0 (2.0 version by Keith Rollin)
  7. ** Modified by:      Eric Soldan
  8. **
  9. ** Copyright © 1990-1991 Apple Computer, Inc.
  10. ** All rights reserved.
  11. */
  12.  
  13.  
  14.  
  15. /*****************************************************************************/
  16.  
  17.  
  18.  
  19. #include "MacShell.h"            /* Get the MacShell includes/typedefs, etc.    */
  20. #include "MacShellCommon.h"        /* Get the stuff in common with rez.        */
  21. #include "MacShell.protos"        /* Get the prototypes for MacShell.            */
  22.  
  23. #ifndef __TEXTEDITCONTROL__
  24. #include "TextEditControl.h"
  25. #endif
  26.  
  27.  
  28.  
  29. /*****************************************************************************/
  30.  
  31.  
  32.  
  33. extern RgnHandle    gCursorRgn;                /* The current cursor region.
  34.                                             ** The initial cursor region is
  35.                                             ** an empty region, which will
  36.                                             ** cause WaitNextEvent to generate
  37.                                             ** a mouse-moved event, which will
  38.                                             ** cause us to set the cursor for
  39.                                             ** the first time.
  40.                                             */
  41. extern Boolean        gQuitApplication;        /* This is set to false by
  42.                                             ** Initialize.  When the user
  43.                                             ** selects Quit (and does not
  44.                                             ** abort the quit), then this
  45.                                             ** boolean is set true.
  46.                                             */
  47.  
  48.  
  49.  
  50. /*****************************************************************************/
  51. /*****************************************************************************/
  52.  
  53.  
  54.  
  55. /* Get events forever, and handle them by calling DoEvent.  Get the events by
  56. ** calling WaitNextEvent.  (This sample does a DeathAlert if WaitNextEvent
  57. ** isn't available.)
  58. */
  59.  
  60. #pragma segment Main
  61. void    EventLoop(void)
  62. {
  63.     EventRecord        event;
  64.  
  65.     while (!gQuitApplication) {
  66.         WaitNextEvent(everyEvent, &event, 15, gCursorRgn);
  67.         DoEvent(&event);
  68.     };
  69. }
  70.  
  71.  
  72.  
  73.